<template>
	<div id="contentBox">
		<div class="searchBox">
			<el-form :inline="true"  ref="searchForm"  :model="searchForm" label-width="96px">
				<el-form-item label="发布日期起" prop="startDate" >
				    <el-date-picker :editable="false"   
				      @change="debounceSeach"
				      v-model="searchForm.startDate"
				      type="date"
				      placeholder="选择日期"
				      :picker-options="startDateOpt"
				      >
				    </el-date-picker>
				</el-form-item>
				<el-form-item label="发布日期止" prop="endDate" >
				    <el-date-picker :editable="false"  
				      @change="debounceSeach"
				      v-model="searchForm.endDate"
				      type="date"
				      placeholder="选择日期"
				      :picker-options="endDateOpt"
				      >
				    </el-date-picker>
				</el-form-item>
	            <el-form-item label="发布人" prop='releasePerson'>
				   <el-input v-model="searchForm.releasePerson" placeholder="请输入搜索内容..." @input.native="debounceSeach"></el-input >
				</el-form-item>
				 <el-form-item label="经销商名称" prop='dealerName' >
				   <el-input v-model="searchForm.dealerName" placeholder="请输入搜索内容..." @input.native="debounceSeach"></el-input >
				</el-form-item>
				  <el-form-item label="汽车车型"  prop="carTypeName">
				   <el-input v-model="searchForm.carTypeName" placeholder="汽车子品牌/汽车车系/汽车车型" @input.native="debounceSeach" ></el-input >
				</el-form-item>
				<el-form-item label="汽车车规" prop="carSpecifications" >
				     <el-select v-model="searchForm.carSpecificationId" placeholder="请选择车规状态" @change="debounceSeach">
	                 <el-option label="请选择车规状态" value=""></el-option>			   
				     <el-option v-for="(item, index) in carSpecifications" :label="item.name" :value="item.id" :key="index">
				     </el-option>
				   </el-select>
				</el-form-item>
			   <el-form-item label="车源状态" prop="status" >
				     <el-select v-model="searchForm.status" placeholder="请选择订单状态" @change="debounceSeach">
	                 <el-option label="请选择车源状态" value=""></el-option>			   
				     <el-option v-for="(item, index) in statusMap" :label="item" :value="index" :key="index">
				     </el-option>
				   </el-select>
				</el-form-item>
	           
				<el-form-item style="text-align:left;margin-bottom: 10px;">
				    <el-button @click="resetSearchForm('searchForm')">重置</el-button>
				    <el-button @click="exportExcels(searchForm,'v_2.0/car_source/export','所有车源')">导出</el-button>						
				</el-form-item>
			</el-form>
		</div>
		<div id="tableBox" style="margin:0 25px;" >
			<el-table :data="tableData.data.tableData.data" border id='table'  >
			    <el-table-column label="汽车车型" :min-width="200">
			      <template scope="scope">
			        <span >{{ scope.row.carName }}</span>
			      </template>
			    </el-table-column>
			    <el-table-column label="外观/内饰颜色" >
			      <template scope="scope">
			        <span >{{ scope.row.color }}</span>
			      </template>
			    </el-table-column>
					<el-table-column label="车规" >
			      <template scope="scope">
			        <span >{{scope.row.carSpecificationName }}</span>
			      </template>
			    </el-table-column>
					<el-table-column label="指导价" >
			      <template scope="scope">
			        <span >{{scope.row.guidancePrice| toFixed2}}</span>
			      </template>
			    </el-table-column>
					<el-table-column label="报价" >
			      <template scope="scope">
			        <span >{{scope.row.quotePrice| toFixed2}}</span>
			      </template>
			    </el-table-column>
					<el-table-column label="经销商名称" >
			      <template scope="scope">
			        <span >{{scope.row.dealerName }}</span>
			      </template>
			    </el-table-column>
			     <el-table-column label="发布人" >
			      <template scope="scope">
			        <span >{{ scope.row.releasePerson  }}</span>
			      </template>
			    </el-table-column>
			     <el-table-column label="发布时间" >
			      <template scope="scope">
			        <span >{{getDate( scope.row.addDate) }}</span>
			      </template>
			    </el-table-column>
			     <el-table-column label="车源状态" >
			      <template scope="scope">
			        <span >{{ scope.row.statusString  }}</span>
			      </template>
			    </el-table-column>
			    <el-table-column label="操作">
			      <template scope="scope">
			      	<el-button size="small" @click="handleSee(scope.$index, scope.row)">查看</el-button>
			      	<el-button size="small" @click="cancel(scope.$index, scope.row)" v-if='scope.row.status==4'>下架</el-button>			      	
			      </template>
			    </el-table-column>
			</el-table>
           <!--  查看弹窗 -->
            <el-dialog  title="所有车源" v-if="dialogSendData.dialogFormVisible" :visible.sync="dialogSendData.dialogFormVisible"  :lock-scroll='false' top=5% :close-on-click-modal="false">
				<dialogForm @Refresh='seachData()' :dialogSendData="dialogSendData" :tableData="tableData"></dialogForm>
				
			</el-dialog>
	    </div>
	    <div class="block" style="text-align: center;margin-top: 15px;">
		    <pagination v-on:refreshSeachData="seachData()"  :tableData="tableData.data.tableData" :searchForm="searchForm||{}"></pagination>
		</div>
	</div>
</template>
<script src="./index.js">

</script>
<style scoped lang="stylus" rel="styleheet/stylus">
	@import './index.styl';
</style>